﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RelationExpertSystem.Relation
{
    public class Parent : RelationBase
    {
        private static Parent _singleton = new Parent();
        public static Parent Instance
        {
            get { return _singleton; }
        }

        private Parent() { }

        public override bool IsRelated(Person a, Person b)
        {
            // b is a's parent IFF b is a's mother or b is a's father
            return b == a.Mother || b == a.Father;
        }

        public override IEnumerable<IRelation> GetDependencies()
        {
            return new HashSet<IRelation>(new IRelation[] { Mother.Instance, Father.Instance });
        }
    }
}
